package demo;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class JDesktopPaneDemo extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JDesktopPaneDemo frame = new JDesktopPaneDemo();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public JDesktopPaneDemo() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		JDesktopPane desk = new JDesktopPane();
		contentPane.add(desk);
		JInternalFrame in = null;
		for (int i = 0; i < 3; i++) {
			in = new JInternalFrame("窗口"+i, true, true, true);
			JPanel jp = new JPanel();
			//new ImageIcon(JDesktopPaneDemo.class.getResource("/img/73bOOOPIC33.jpg"));
			jp.add(new JLabel(new ImageIcon(JDesktopPaneDemo.class.getResource("/img/73bOOOPIC33.jpg"))));
			in.add(jp);
			
			in.setLocation(35 - i * 10, 35 - i * 10);
			in.pack();
			in.setVisible(true) ;
			desk.add(in);
		}
		setContentPane(contentPane);
	}

}
